#include <iostream>
#include <cstring>


static int count=1;
void docombine(char* str,char* outstr, int len, int start,int level){
    for(int i=start;i<len;i++){
        outstr[level++]=str[i];
        outstr[level]=0;
        std::cout<<count++<<":"<<outstr<<std::endl;
        if(i < len-1){
            docombine(str,outstr,len,i+1,level);
        }
    }
}

void combine(char* str){
    int len=strlen(str);
    static char outstr[128];
    docombine(str,outstr,len,0,0);
}



int main()
{
	combine("abcd");
	return 0;
}
